package com.czy;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Slf4j
@Component
public class ConsumerUser  {

    @Service
    @RocketMQMessageListener(topic = "rocket-topic-1", consumerGroup = "broker-b-group-1")
    public class ConsumerOne implements RocketMQListener<String> {
        @Override
        public void onMessage(String message) {
            System.out.println("ConsumerUser Receive message："+message);
        }
    }

    @Service
    @RocketMQMessageListener(topic = "user", consumerGroup = "broker-b-group-2")
    public class ConsumerTwo implements RocketMQListener<User> {
        @Override
        public void onMessage(User user) {
            System.out.println("Receive message："+user.toString());
        }
    }
}
